(*
distance function should accept two coordinates as parameters
this takes point objects as params
*)

class point =
object
  val mutable long = 0.0
  val mutable lat = 0.0
  method get_long = long
  method get_lat = lat
  method set_long set = long <- set
  method set_lat set = lat <- set
end

let pi = 4.0 *. atan 1.0 and r = 6371.0
let point1 = new point
let point2 = new point

let startLat = point1#get_latitude and startLong = point1#get_longitude and point

let startLat = point1#get_lat and startLong = point1#get_long and endLat = point2#get_lat and endLong = point2#get_long in (acos ((sin (startLat *. pi /. 180.0))*.(sin (endLat*. pi /. 180.0))+.(cos (startLat*. pi /. 180.0))*.(cos (endLat *. pi /. 180.0))*.(cos ((endLong*. pi /. 180.0)-.(startLong*. pi /. 180.0))))) *. r

Printf.printf "Distance is %d km" distance point1 point2
